import React from "react";
import { useEffect, useState, useMemo } from "react";
import { useUrlQueryParam } from "utils/url";


export const useProjectsSearchParams = () => {
    const [keys] = useState<("name" | "personId")[]>(["name", "personId"]);
  //定义了一个名为keys的状态变量，
  //它的初始值是一个包含两个字符串"personId"和"name"的数组，
  //并且这个状态变量的类型被限定为只能包含这两个字符串的数组。
  const [param, setParam] = useUrlQueryParam<"name" | "personId">(keys);
  return [useMemo(() => ({
    ...param,
    personId: Number(param.personId) || undefined,
  }), [param]), setParam] as const;
}